/**
 * @author 帅瑞杰
 * @Date 2025/3/23:8:28
 * @Description:
 */
import jakarta.servlet.*;
import jakarta.servlet.annotation.WebFilter;


import java.io.IOException;

@WebFilter("/a")
public class MyFilter implements Filter {

    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("过滤器被初始化了");
    }


    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("过滤器逻辑执行");
        System.out.println("MyFilter 放行前逻辑");//1
        filterChain.doFilter(servletRequest, servletResponse);  //放行
        System.out.println("MyFilter 放行后逻辑");//4
    }


    public void destroy() {
        System.out.println("过滤器被销毁了");
    }
}